package com.xyy.saas.payment.config;

import com.google.common.base.Preconditions;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

/**
 * @Author: wuqiongda
 * @Date: 2019/10/24 10:15
 */
@Component
public class RsaConfig implements InitializingBean {

    @Value("${pingxx.publicKey}")
    private String publicKey;

    @Value("${pingxx.privateKey}")
    private String privateKey;

    public String getPublicKey() {
        return publicKey;
    }

    public void setPublicKey(String publicKey) {
        this.publicKey = publicKey;
    }

    public String getPrivateKey() {
        return privateKey;
    }

    public void setPrivateKey(String privateKey) {
        this.privateKey = privateKey;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        Preconditions.checkArgument(!StringUtils.isEmpty(publicKey));
        Preconditions.checkArgument(!StringUtils.isEmpty(privateKey));
    }
}
